package com.longxi.tianjintianbao.ui.activity.complaint;

import android.content.Intent;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.longxi.tianjintianbao.R;
import com.longxi.tianjintianbao.ui.base.BaseActivity;
import com.longxi.tianjintianbao.ui.presenter.complaint.ComplaintDetailAtPresenter;
import com.longxi.tianjintianbao.ui.view.complaint.IComplaintDetailAtView;

import butterknife.BindView;

/**
 * Created by 70339 on 2018/5/3.
 * 代码无八阿哥
 * 阿弥陀佛
 */
public class ComplaintDetailActivity extends BaseActivity<IComplaintDetailAtView, ComplaintDetailAtPresenter> implements IComplaintDetailAtView {
    @BindView(R.id.tvDate)
    TextView mTvDate;
    @BindView(R.id.tvStatus)
    TextView mTvStatus;
    @BindView(R.id.tvName)
    TextView mTvName;
    @BindView(R.id.tvAddress)
    TextView mTvAddress;
    @BindView(R.id.tvTaskContent)
    TextView mTvTaskContent;
    @BindView(R.id.tvDealState)
    TextView mTvDealState;
    @BindView(R.id.tvDealDate)
    TextView mTvDealDate;
    @BindView(R.id.tvDealResult)
    TextView mTvDealResult;
    @BindView(R.id.tvDealOther)
    TextView mTvDealOther;
    @BindView(R.id.tvComplaintFollow)
    TextView mTvComplaintFollow;

    @BindView(R.id.llState)
    LinearLayout mLlState;
    @BindView(R.id.llCannot)
    LinearLayout mLlCannot;
    @BindView(R.id.btnPause)
    Button mBtnPause;
    @BindView(R.id.btnComplete)
    Button mBtnComplete;

    @Override
    protected int provideContentViewId() {
        return R.layout.activity_complain_detail;
    }

    @Override
    public void initData() {
        super.initData();
        mPresenter.setBar();
        mPresenter.getComplaint();
//        mPresenter.getComplaintFollow();
    }

    public void saveComplaint(String type, String result){
        mPresenter.saveComplaint(type, result);
    }

    @Override
    public void initListener() {
        super.initListener();
//        mBtnComplete.setOnClickListener(v -> mPresenter.showComplaintDealDialogFragment());
        mBtnComplete.setOnClickListener(v -> mPresenter.onCommit());
        mBtnPause.setOnClickListener(v -> mPresenter.onUpdate());
        mTvRight.setOnClickListener(v -> mPresenter.complaintProgrammeDialog());
    }

    @Override
    protected ComplaintDetailAtPresenter createPresenter() {
        return new ComplaintDetailAtPresenter(this);
    }

    @Override
    public TextView getTvDate() {
        return mTvDate;
    }

    @Override
    public TextView getTvStatus() {
        return mTvStatus;
    }

    @Override
    public TextView getTvName() {
        return mTvName;
    }

    @Override
    public TextView getTvAddress() {
        return mTvAddress;
    }

    @Override
    public TextView getTvTaskContent() {
        return mTvTaskContent;
    }

    @Override
    public TextView getTvDealState() {
        return mTvDealState;
    }

    @Override
    public TextView getTvDealDate() {
        return mTvDealDate;
    }

    @Override
    public TextView getTvDealResult() {
        return mTvDealResult;
    }

    @Override
    public TextView getTvDealOther() {
        return mTvDealOther;
    }

    @Override
    public TextView getTvComplaintFollow() {
        return mTvComplaintFollow;
    }

    @Override
    public LinearLayout getLlState() {
        return mLlState;
    }

    @Override
    public LinearLayout getLlCannot() {
        return mLlCannot;
    }

    @Override
    public Button getBtnPause() {
        return mBtnPause;
    }

    @Override
    public Button getBtnComplete() {
        return mBtnComplete;
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        mPresenter.onActivityResult(requestCode, resultCode, data);
    }
}
